package com.xxy.lineartable;

/**
 * @author xxy
 * @create 2020 10 07 19:17
 * 定义对线性表的基操作：增删改查
 */
public interface MyList {
    //1:返回线性表大小
    public int getSize();
    //2：判断线性表是否为空：false:true
    public boolean isEmpty();
    //3:判断线性表是否含有元素e
    public boolean contains(Object e);
    //4: 查找 返回e元素所在的位置
    public int indexOf(Object e);
    //4.1:查找 返回第i个位置的元素
    public Object get(int i);
    //5：将元素e插入到顺序表的第i个位置
    public void add(int i,Object e) throws Exception;
    public void add(Object e) throws Exception;
    //6：将元素e插入到obj之前
    public boolean addBefore(Object obj,Object e) throws Exception;
    //7：将元素e插入到obj之后
    public boolean addAfter(Object obj,Object e) throws Exception;
    //8:删除第i个位置元素
    public void remove(int i) throws Exception;
    //9：删除线性表中第一个为e的元素
    public boolean removed (Object e) throws Exception;
    //10：替换第i个元素为e
    public Object replace(int i,Object e) throws Exception;
    //11:输出线性表
    public void display();
}
